<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    用户名：<input type="text" id="name" /> 密码：<input type="text" id="pwd" />
    邮箱：<input type="text" id="yx" />
    <button id="btn">注册</button>
  </body>
  <script>
    window.onload = function () {
      btn.onclick = fun;
    };
    function fun() {
      let username = name.value,
        password = pwd.value,
        email = yx.value;
      let httpAjax = new XMLHttpRequest();
      httpAjax.onreadystatechange = function () {
        if (httpAjax.readyState === 4 && httpAjax.status === 200) {
          let res = JSON.parse(httpAjax.responseText);
        }
      };
      httpAjax.open("POST", "https://liu.zzgoodqc.cn/login", true);
      httpAjax.setRequestHeader(
        "Content-type",
        "application/x-www-form-urlencoded"
      );
      httpAjax.send(
        "username=" + username + "&password=" + password + "&email=" + email
      );
    }
  </script>
</html>
